﻿namespace iFinance.Infrastructure.ViewModels
{
    using System.Collections.ObjectModel;
    using iFinance.Entity;
    using Microsoft.Practices.Prism.ViewModel;

    /// <summary>
    /// 支出类别项ViewModel
    /// </summary>
    public class OutgoingsTypeItemViewModel : NotificationObject
    {
        #region Ctor

        public OutgoingsTypeItemViewModel()
            : this(new OutgoingsType())
        {
        }

        public OutgoingsTypeItemViewModel(OutgoingsType outgoingsType)
        {
            this.RealData = outgoingsType;
        }

        #endregion

        #region 属性

        /// <summary>
        /// 代理的真实数据
        /// </summary>
        public OutgoingsType RealData { get; private set; }

        /// <summary>
        /// 类型唯一编号
        /// </summary>
        public int ID
        {
            get { return RealData.ID; }
            set
            {
                if (RealData.ID != value)
                {
                    RealData.ID = value;
                    RaisePropertyChanged(() => this.ID);
                }
            }
        }

        /// <summary>
        /// 父类型唯一编号
        /// </summary>
        public int ParentID
        {
            get { return RealData.ParentID; }
            set
            {
                if (RealData.ParentID != value)
                {
                    RealData.ParentID = value;
                    RaisePropertyChanged(() => this.ParentID);
                }
            }
        }

        /// <summary>
        /// 类型名称
        /// </summary>
        public string Name
        {
            get { return RealData.Name; }
            set
            {
                if (RealData.Name != value)
                {
                    RealData.Name = value;
                    RaisePropertyChanged(() => this.Name);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// 支出类别列表ViewModel
    /// </summary>
    public class OutgoingsTypeListViewModel : ObservableCollection<OutgoingsTypeItemViewModel>
    {
    }
}